{% extends "lbforum/base.html" %}

{% load lbforum %}

{% block title %}{{  block.super }}{% endblock %}

{% block extra_header %}
    <link rel="stylesheet" type="text/css" media="screen" href="{{ MEDIA_URL }}scripts/markitup/skins/markitup/style.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="{{ MEDIA_URL }}scripts/markitup/bbcode/style.css" />
{% endblock %}

{% block content %}
    <div id="actionbox">
    </div>  
    <div id="brd-wrap" class="brd">
        <div id="brd-viewforum" class="brd-page paged-page">
            {% include 'lbforum/inc_header.html' %}
            {% include 'lbforum/inc_announce.html' %}

            <div class="hr"><hr /></div>

            <div class="crumbs gen-content" id="brd-crumbs-top">
                {% include 'lbforum/inc_new_post_brd_crumbs.html' %}
            </div>
            <div class="main-wrapper" id="brd-main">
                <div class="main-head">
                    <h1 class="hn"><span>Post new {{ action_type }}</span></h1>
                </div>
                {% if preview %}
                <div class="main-subhead">
                    <h2 class="hn"><span>Preview your new {{ action_type }}</span></h2>
                </div>
                <div class="main-content main-frm" id="post-preview">
                    <div class="post singlepost">
                        <div class="posthead">
                            <h3 class="hn"><span class="post-num">#</span> <span class="post-byline"><span>Topic by </span><strong>{{ user.username }}</strong></span> <span class="post-link">{% now "Y-m-d H:i" %}</span></h3>
                        </div>
                        <div class="postbody">
                            <div class="post-entry">
                                <div class="entry-content">
                                    <p>{{form.cleaned_data.message|bbcode|safe}}</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                {% endif %}
                <div class="main-subhead">
                    <h2 class="hn"><span>Compose and post your new {{ action_type }}</span></h2>
                </div>
                <div class="main-content main-frm" id="post-form">
                    <p class="ct-options options">You may use: <span class="item1"><a title="Help with: BBCode" href="http://fluxbb.org/forums/help/bbcode/" class="exthelp">BBCode</a></span> <span><a title="Help with: Images" href="http://fluxbb.org/forums/help/img/" class="exthelp">Images</a></span> <span><a title="Help with: Smilies" href="http://fluxbb.org/forums/help/smilies/" class="exthelp">Smilies</a></span></p>
                    {% if form.errors %}
                        <div class="ct-box error-box" id="req-msg">
                            <p class="errornote"> Please correct the errors below.  </p>
                            {{form.errors}}
                        </div>
                    {% endif %}
                    <form action="" accept-charset="utf-8" method="post" class="frm-form" id="afocus">
                        <div class="hidden">
                            {% csrf_token %} 
                        </div>
                        <fieldset class="frm-group group1">
                            <legend class="group-legend"><strong>Required information</strong></legend>
                            {% if not topic %}
                                <div class="sf-set set1">
                                    <div class="sf-box text required longtext">
                                        <label for="id_subject"><span>Topic subject: <em>(Required)</em></span></label><br/>
                                        <span class="fld-input">
                                            {{form.subject}}
                                        </span>
                                    </div>
                                </div>
                            {% endif %}
                            <div class="txt-set {% if topic %}set1{% else %}set2{% endif %}">
                                <div class="txt-box textarea required">
                                    <label for="id_message"><span>Write message: <em>(Required)</em></span></label>
                                    <div class="txt-input"><span class="fld-input">
                                            {{form.message}}
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <fieldset class="mf-set set3">
                                <legend><span>Optional post settings:</span></legend>
                                <div class="mf-box checkbox">
                                    <div class="mf-item">
                                        <span class="fld-input"><input type="checkbox" value="1" name="hide_smilies" id="fld3"/></span> 
                                        <label for="fld3">Never show smilies as icons (images) for this post.</label>
                                    </div>
                                </div>
                            </fieldset>
                        </fieldset>
                        <div class="frm-buttons">
                            <span class="submit"><input type="submit" value="Submit topic" name="submit"/></span>
                            <span class="submit"><input type="submit" value="Preview topic" name="preview"/></span>
                        </div>
                    </form>
                </div>
                {% if first_post %}
                    <div class="main-subhead">
                        <h2 class="hn"><span>Topic review (newest first)</span></h2>
                    </div>
                    <div class="main-content main-frm" id="topic-review">
                        <div class="post firstpost lastpost">
                            <div class="posthead">
                                <h3 class="hn post-ident">
                                    <span class="post-num">1</span> <span class="post-byline"><span>Post by </span><strong>{{ first_post.posted_by.username }}</strong></span> 
                                    <span class="post-link">{{ first_post.created_on|timesince }}</span>
                                </h3>
                            </div>
                            <div class="postbody">
                                <div class="post-entry">
                                    <div class="entry-content">
                                        <p>{{ first_post.message|bbcode|safe }}</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                {% endif %}
            </div>
            <div class="crumbs gen-content" id="brd-crumbs-end">
                {% include 'lbforum/inc_new_post_brd_crumbs.html' %}
            </div>
            <div class="hr"><hr /></div>
            {% include 'lbforum/inc_copyright.html' %}
        </div>
    </div>

<!-- Load jQuery -->
<!--
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
	google.load("jquery", "1.3");
</script>
-->
<script type="text/javascript" src="{{ MEDIA_URL }}scripts/jquery.min.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}scripts/markitup/jquery.markitup.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}scripts/markitup/bbcode/set.js"></script>
<script type="text/javascript" >
   $().ready(function() {
      $("#id_message").markItUp(mySettings);
   });
</script>
	
{% endblock %}
